/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.invernadero.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Raven
 */
@Entity
@Table(name = "day")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Day.findAll", query = "SELECT d FROM Day d"),
    @NamedQuery(name = "Day.findByIdDay", query = "SELECT d FROM Day d WHERE d.idDay = :idDay"),
    @NamedQuery(name = "Day.findByNameDay", query = "SELECT d FROM Day d WHERE d.nameDay = :nameDay"),
    @NamedQuery(name = "Day.findByWorked", query = "SELECT d FROM Day d WHERE d.worked = :worked"),
    @NamedQuery(name = "Day.findByHourWorked", query = "SELECT d FROM Day d WHERE d.hourWorked = :hourWorked"),
    @NamedQuery(name = "Day.findByOverTime", query = "SELECT d FROM Day d WHERE d.overTime = :overTime"),
    @NamedQuery(name = "Day.findByMonth", query = "SELECT d FROM Day d WHERE d.month = :month"),
    @NamedQuery(name = "Day.findByNumberWeek", query = "SELECT d FROM Day d WHERE d.numberWeek = :numberWeek")})
public class Day implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idDay")
    private Integer idDay;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "NameDay")
    private String nameDay;
    @Basic(optional = false)
    @NotNull
    @Column(name = "worked")
    private int worked;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hourWorked")
    private int hourWorked;
    @Column(name = "overTime")
    private Integer overTime;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "month")
    private String month;
    @Basic(optional = false)
    @NotNull
    @Column(name = "numberWeek")
    private int numberWeek;
    @JoinColumn(name = "staff_idstaff", referencedColumnName = "idstaff")
    @ManyToOne
    private Staff staffIdstaff;

    public Day() {
    }

    public Day(Integer idDay) {
        this.idDay = idDay;
    }

    public Day(Integer idDay, String nameDay, int worked, int hourWorked, String month, int numberWeek) {
        this.idDay = idDay;
        this.nameDay = nameDay;
        this.worked = worked;
        this.hourWorked = hourWorked;
        this.month = month;
        this.numberWeek = numberWeek;
    }

    public Integer getIdDay() {
        return idDay;
    }

    public void setIdDay(Integer idDay) {
        this.idDay = idDay;
    }

    public String getNameDay() {
        return nameDay;
    }

    public void setNameDay(String nameDay) {
        this.nameDay = nameDay;
    }

    public int getWorked() {
        return worked;
    }

    public void setWorked(int worked) {
        this.worked = worked;
    }

    public int getHourWorked() {
        return hourWorked;
    }

    public void setHourWorked(int hourWorked) {
        this.hourWorked = hourWorked;
    }

    public Integer getOverTime() {
        return overTime;
    }

    public void setOverTime(Integer overTime) {
        this.overTime = overTime;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public int getNumberWeek() {
        return numberWeek;
    }

    public void setNumberWeek(int numberWeek) {
        this.numberWeek = numberWeek;
    }

    public Staff getStaffIdstaff() {
        return staffIdstaff;
    }

    public void setStaffIdstaff(Staff staffIdstaff) {
        this.staffIdstaff = staffIdstaff;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDay != null ? idDay.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Day)) {
            return false;
        }
        Day other = (Day) object;
        if ((this.idDay == null && other.idDay != null) || (this.idDay != null && !this.idDay.equals(other.idDay))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itschapala.dsw2.invernadero.modelo.Day[ idDay=" + idDay + " ]";
    }
    
}
